<?php /* Copyright 2010 Karl R. Wilcox

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License. */


function makeTreatment ( $node ) {

  $treatment_data = array (
    'checky'    => array(  'link' => 'http://karlwilcox.com/parker/c/chequy', 'width' => 200, 'height' => 200, 'body' => '<path d="M0,0h100v100h-100z M100,100h100v100h-100z"  />' ),
    'checky45' => array (  'link' => 'http://karlwilcox.com/parker/c/chequy', 'width' => 141.42, 'height' => 141.42, 'body' => '<path d="M70.71,0L141.42,70.71 70.71,141.42 0,70.71Z"  />' ),
    'compony' => array (  'link' => 'http://karlwilcox.com/parker/c/compony', 'width' => 333, 'height' => 300, 'body' => '<path d="M0,0 h167v300h-167z M166,300 h167v300h-167z"/>' ),
	'plumetty' => array (  'link' => 'http://karlwilcox.com/parker/p/plumete', 'width' => 98, 'height' => 184, 'body' =>
		'<path transform="scale(2,2)" style="stroke:none;" d="M 18.57769,-0.887655 C 18.61159,18.48271 8.84867,29.37811 -0.99888,35.33374 -1.29992,76.47672 19.8913,88.43415 23.6811,91.49845 27.4709,88.43415 48.63511,76.47672 48.33408,35.33374 38.48652,29.37811 28.75064,18.48271 28.78451,-0.887655 l -5.10341,0 z" />
		<path transform="scale(2,2)" style="fill:#808080;fill-opacity:1;stroke:none;" d="m 47.92906,60.35076 0,25.54902 c -2.35704,-0.0178 -5.25806,-0.7696 -7.72262,-1.83263 l -0.40504,0.97021 c 2.57715,1.1116 5.54831,1.92413 8.12766,1.94044 l 0,6.5759 c -3.27185,0.005 -6.44995,-0.52379 -10.07181,-2.34469 l -0.48604,0.94327 c 3.76964,1.89519 7.1644,2.48096 10.55785,2.47944 l 0,6.89931 c -2.45642,-0.098 -4.44832,-1.11461 -6.80455,-2.02128 -1.87117,-0.72002 -3.96084,-1.33415 -6.61553,-1.23972 -0.88489,0.0315 -1.84214,0.13781 -2.86223,0.35036 l 0.21602,1.05106 c 3.85601,-0.80342 6.43656,-0.0958 8.85671,0.83547 2.29906,0.88467 4.46139,2.0063 7.20958,2.10213 l 0,6.79151 c -3.07921,-0.0754 -5.11232,-1.20064 -8.04665,-2.56029 -1.2464,-0.57753 -3.26242,-1.54643 -5.34643,-1.85958 -0.52101,-0.0783 -1.04522,-0.10622 -1.56612,-0.0809 -0.52091,0.0254 -1.0385,0.10403 -1.53913,0.26951 -1.00125,0.33096 -1.91362,1.01845 -2.5922,2.10213 l 0.91807,0.56596 c 0.55689,-0.88933 1.24103,-1.38478 2.02516,-1.64398 0.78414,-0.25919 1.69002,-0.27437 2.61921,-0.13475 1.85838,0.27925 3.79474,1.19737 5.04941,1.77873 2.90741,1.34718 5.13315,2.56832 8.47868,2.64114 l 0,5.84825 c -2.45642,-0.098 -4.44832,-1.11461 -6.80455,-2.02128 -1.87117,-0.72002 -3.96084,-1.33415 -6.61553,-1.23972 -0.88489,0.0315 -1.84214,0.13781 -2.86223,0.35035 l 0.21602,1.05107 c 3.85601,-0.80342 6.43656,-0.0958 8.85671,0.83546 2.29906,0.88468 4.46139,2.0063 7.20958,2.10214 l 0,6.0369 c -3.3283,-0.0846 -5.16066,-0.74455 -6.93956,-1.45533 -1.85803,-0.7424 -3.70967,-1.52477 -6.88555,-1.53617 l 0,1.07801 c 3.00446,0.0108 4.60555,0.70616 6.48052,1.45533 1.7999,0.71917 3.85445,1.44808 7.34459,1.53617 l 0,6.0369 c -3.27185,0.005 -6.44995,-0.5238 -10.07181,-2.34469 l -0.48604,0.94327 c 3.76964,1.89518 7.1644,2.48096 10.55785,2.47944 l 0,6.06385 c -2.35704,-0.0178 -5.25806,-0.76959 -7.72262,-1.83263 l -0.40504,0.97022 c 2.57715,1.11159 5.54831,1.92412 8.12766,1.94043 l 0,3.98866 0.86407,0 0,-3.98866 c 2.57935,-0.0163 5.5505,-0.82884 8.12765,-1.94043 l -0.40504,-0.97022 c -2.46456,1.06304 -5.36558,1.81485 -7.72261,1.83263 l 0,-6.06385 c 3.39345,0.002 6.7882,-0.58426 10.55784,-2.47944 l -0.48604,-0.94327 c -3.62186,1.82089 -6.79996,2.35008 -10.0718,2.34469 l 0,-6.0369 c 3.49013,-0.0881 5.54468,-0.817 7.34458,-1.53617 1.87497,-0.74917 3.47606,-1.44454 6.48052,-1.45533 l 0,-1.07801 c -3.17588,0.0114 -5.02751,0.79377 -6.88555,1.53617 -1.7789,0.71078 -3.61126,1.37077 -6.93955,1.45533 l 0,-6.0369 c 2.74818,-0.0958 4.91051,-1.21746 7.20957,-2.10214 2.42015,-0.93126 5.0007,-1.63888 8.85671,-0.83546 l 0.21602,-1.05107 c -1.02009,-0.21254 -1.97734,-0.31887 -2.86223,-0.35035 -2.65469,-0.0944 -4.74436,0.5197 -6.61553,1.23972 -2.35623,0.90667 -4.34812,1.92326 -6.80454,2.02128 l 0,-5.84825 c 3.34552,-0.0728 5.57126,-1.29396 8.47867,-2.64114 1.25467,-0.58136 3.19103,-1.49948 5.04941,-1.77873 0.92919,-0.13962 1.83508,-0.12444 2.61921,0.13475 0.78414,0.2592 1.46827,0.75465 2.02516,1.64398 l 0.91807,-0.56595 c -0.67858,-1.08369 -1.59095,-1.77117 -2.5922,-2.10214 -0.50063,-0.16548 -1.01822,-0.24414 -1.53913,-0.2695 -0.5209,-0.0254 -1.04511,0.003 -1.56612,0.0808 -2.08401,0.31315 -4.10003,1.28205 -5.34643,1.85958 -2.93433,1.35966 -4.96744,2.4849 -8.04664,2.5603 l 0,-6.79152 c 2.74818,-0.0958 4.91051,-1.21746 7.20957,-2.10213 2.42015,-0.93127 5.0007,-1.63888 8.85671,-0.83546 l 0.21602,-1.05107 c -1.02009,-0.21254 -1.97734,-0.31888 -2.86223,-0.35036 -2.65469,-0.0944 -4.74436,0.5197 -6.61553,1.23972 -2.35623,0.90668 -4.34812,1.92327 -6.80454,2.02129 l 0,-6.89932 c 3.39345,0.002 6.7882,-0.58425 10.55784,-2.47944 l -0.48604,-0.94327 c -3.62186,1.8209 -6.79996,2.35008 -10.0718,2.34469 l 0,-6.5759 c 2.57935,-0.0163 5.5505,-0.82884 8.12765,-1.94044 l -0.40504,-0.97021 c -2.46456,1.06303 -5.36558,1.81485 -7.72261,1.83263 l 0,-25.54902 -0.86407,0 z"/>
		<path transform="scale(2,2)" style="fill:#808080;fill-opacity:1;stroke:none;" d="m -1.40389,60.35076 0,25.54902 c -2.35704,-0.0178 -5.25806,-0.7696 -7.72262,-1.83263 l -0.40504,0.97021 c 2.57715,1.1116 5.54831,1.92413 8.12766,1.94044 l 0,6.5759 c -3.27185,0.005 -6.44995,-0.52379 -10.07181,-2.34469 l -0.48604,0.94327 c 3.76964,1.89519 7.1644,2.48096 10.55785,2.47944 l 0,6.89931 c -2.45642,-0.098 -4.44832,-1.11461 -6.80455,-2.02128 -1.87117,-0.72002 -3.96084,-1.33415 -6.61553,-1.23972 -0.88489,0.0315 -1.84214,0.13781 -2.86223,0.35036 l 0.21602,1.05106 c 3.85601,-0.80342 6.43656,-0.0958 8.85671,0.83547 2.29906,0.88467 4.46139,2.0063 7.20958,2.10213 l 0,6.79151 c -3.07921,-0.0754 -5.11232,-1.20064 -8.04665,-2.56029 -1.2464,-0.57753 -3.26242,-1.54643 -5.34643,-1.85958 -0.52101,-0.0783 -1.04522,-0.10622 -1.56612,-0.0809 -0.52091,0.0254 -1.0385,0.10403 -1.53913,0.26951 -1.00125,0.33096 -1.91362,1.01845 -2.5922,2.10213 l 0.91807,0.56596 c 0.55689,-0.88933 1.24103,-1.38478 2.02516,-1.64398 0.78414,-0.25919 1.69002,-0.27437 2.61921,-0.13475 1.85838,0.27925 3.79474,1.19737 5.04941,1.77873 2.90741,1.34718 5.13315,2.56832 8.47868,2.64114 l 0,5.84825 c -2.45642,-0.098 -4.44832,-1.11461 -6.80455,-2.02128 -1.87117,-0.72002 -3.96084,-1.33415 -6.61553,-1.23972 -0.88489,0.0315 -1.84214,0.13781 -2.86223,0.35035 l 0.21602,1.05107 c 3.85601,-0.80342 6.43656,-0.0958 8.85671,0.83546 2.29906,0.88468 4.46139,2.0063 7.20958,2.10214 l 0,6.0369 c -3.3283,-0.0846 -5.16066,-0.74455 -6.93956,-1.45533 -1.85803,-0.7424 -3.70967,-1.52477 -6.88555,-1.53617 l 0,1.07801 c 3.00446,0.0108 4.60555,0.70616 6.48052,1.45533 1.7999,0.71917 3.85445,1.44808 7.34459,1.53617 l 0,6.0369 c -3.27185,0.005 -6.44995,-0.5238 -10.07181,-2.34469 l -0.48604,0.94327 c 3.76964,1.89518 7.1644,2.48096 10.55785,2.47944 l 0,6.06385 c -2.35704,-0.0178 -5.25806,-0.76959 -7.72262,-1.83263 l -0.40504,0.97022 c 2.57715,1.11159 5.54831,1.92412 8.12766,1.94043 l 0,3.98866 0.86407,0 0,-3.98866 c 2.57935,-0.0163 5.5505,-0.82884 8.12765,-1.94043 l -0.40504,-0.97022 c -2.46456,1.06304 -5.36558,1.81485 -7.72261,1.83263 l 0,-6.06385 c 3.39345,0.002 6.7882,-0.58426 10.55784,-2.47944 l -0.48604,-0.94327 c -3.62186,1.82089 -6.79996,2.35008 -10.0718,2.34469 l 0,-6.0369 c 3.49013,-0.0881 5.54468,-0.817 7.34458,-1.53617 1.87497,-0.74917 3.47606,-1.44454 6.48052,-1.45533 l 0,-1.07801 c -3.17588,0.0114 -5.02751,0.79377 -6.88555,1.53617 -1.7789,0.71078 -3.61126,1.37077 -6.93955,1.45533 l 0,-6.0369 c 2.74818,-0.0958 4.91051,-1.21746 7.20957,-2.10214 2.42015,-0.93126 5.0007,-1.63888 8.85671,-0.83546 l 0.21602,-1.05107 c -1.02009,-0.21254 -1.97734,-0.31887 -2.86223,-0.35035 -2.65469,-0.0944 -4.74436,0.5197 -6.61553,1.23972 -2.35623,0.90667 -4.34812,1.92326 -6.80454,2.02128 l 0,-5.84825 c 3.34552,-0.0728 5.57126,-1.29396 8.47867,-2.64114 1.25467,-0.58136 3.19103,-1.49948 5.04941,-1.77873 0.92919,-0.13962 1.83508,-0.12444 2.61921,0.13475 0.78414,0.2592 1.46827,0.75465 2.02516,1.64398 l 0.91807,-0.56595 c -0.67858,-1.08369 -1.59095,-1.77117 -2.5922,-2.10214 -0.50063,-0.16548 -1.01822,-0.24414 -1.53913,-0.2695 -0.5209,-0.0254 -1.04511,0.003 -1.56612,0.0808 -2.08401,0.31315 -4.10003,1.28205 -5.34643,1.85958 -2.93433,1.35966 -4.96744,2.4849 -8.04664,2.5603 l 0,-6.79152 c 2.74818,-0.0958 4.91051,-1.21746 7.20957,-2.10213 2.42015,-0.93127 5.0007,-1.63888 8.85671,-0.83546 l 0.21602,-1.05107 c -1.02009,-0.21254 -1.97734,-0.31888 -2.86223,-0.35036 -2.65469,-0.0944 -4.74436,0.5197 -6.61553,1.23972 -2.35623,0.90668 -4.34812,1.92327 -6.80454,2.02129 l 0,-6.89932 c 3.39345,0.002 6.7882,-0.58425 10.55784,-2.47944 L 9.53198,91.20892 c -3.62186,1.8209 -6.79996,2.35008 -10.0718,2.34469 l 0,-6.5759 c 2.57935,-0.0163 5.5505,-0.82884 8.12765,-1.94044 L 7.18279,84.06706 c -2.46456,1.06303 -5.36558,1.81485 -7.72261,1.83263 l 0,-25.54902 -0.86407,0 z" />
		<path transform="scale(2,2)" style="fill:#808080;fill-opacity:1;stroke:none;" d="m 23.24906,4.098177 0,25.549013 c -2.35703,-0.0178 -5.25805,-0.76959 -7.72262,-1.83263 l -0.40503,0.97022 c 2.57715,1.11159 5.5483,1.92413 8.12765,1.94043 l 0,6.57591 c -3.27184,0.005 -6.44994,-0.5238 -10.0718,-2.34469 l -0.48604,0.94326 c 3.76964,1.89519 7.16439,2.48096 10.55784,2.47944 l 0,6.89932 c -2.45642,-0.098 -4.44831,-1.11461 -6.80454,-2.02129 -1.87117,-0.72002 -3.96084,-1.33414 -6.61553,-1.23972 -0.8849,0.0315 -1.84214,0.13782 -2.86223,0.35036 l 0.21602,1.05107 c 3.85601,-0.80342 6.43656,-0.0958 8.85671,0.83546 2.29906,0.88467 4.46138,2.0063 7.20957,2.10213 l 0,6.79152 c -3.0792,-0.0754 -5.11231,-1.20064 -8.04664,-2.5603 C 13.95602,50.01015 11.93999,49.04125 9.85599,48.7281 9.33498,48.6498 8.81077,48.62189 8.28986,48.6473 7.76896,48.6727 7.25137,48.75132 6.75074,48.9168 5.74949,49.24777 4.83712,49.93525 4.15853,51.01894 l 0.91808,0.56596 c 0.55689,-0.88933 1.24102,-1.38479 2.02516,-1.64398 0.78413,-0.2592 1.69002,-0.27438 2.61921,-0.13475 1.85838,0.27924 3.79474,1.19736 5.0494,1.77873 2.90742,1.34718 5.13315,2.56832 8.47868,2.64114 l 0,5.84824 c -2.45642,-0.098 -4.44831,-1.11461 -6.80454,-2.02128 -1.87117,-0.72002 -3.96084,-1.33415 -6.61553,-1.23972 -0.8849,0.0315 -1.84214,0.13781 -2.86223,0.35036 l 0.21602,1.05106 c 3.85601,-0.80341 6.43656,-0.0958 8.85671,0.83547 2.29906,0.88467 4.46138,2.0063 7.20957,2.10213 l 0,6.0369 C 19.92077,67.1046 18.08841,66.44466 16.30951,65.73388 14.45147,64.99148 12.59984,64.20911 9.42395,64.1977 l 0,1.07802 c 3.00447,0.0108 4.60556,0.70616 6.48052,1.45532 1.7999,0.71917 3.85446,1.44808 7.34459,1.53618 l 0,6.0369 c -3.27184,0.005 -6.44994,-0.5238 -10.0718,-2.34469 l -0.48604,0.94326 c 3.76964,1.89519 7.16439,2.48096 10.55784,2.47944 l 0,6.06385 c -2.35703,-0.0178 -5.25805,-0.76959 -7.72262,-1.83263 l -0.40503,0.97022 c 2.57715,1.11159 5.5483,1.92412 8.12765,1.94043 l 0,3.98867 0.86407,0 0,-3.98867 c 2.57935,-0.0163 5.55051,-0.82884 8.12765,-1.94043 l -0.40503,-0.97022 c -2.46457,1.06304 -5.36558,1.81486 -7.72262,1.83263 l 0,-6.06385 c 3.39345,0.002 6.78821,-0.58425 10.55785,-2.47944 l -0.48604,-0.94326 c -3.62186,1.82089 -6.79997,2.35008 -10.07181,2.34469 l 0,-6.0369 c 3.49013,-0.0881 5.54469,-0.81701 7.34459,-1.53618 1.87497,-0.74916 3.47606,-1.44453 6.48052,-1.45532 l 0,-1.07802 c -3.17589,0.0114 -5.02752,0.79378 -6.88555,1.53618 -1.7789,0.71078 -3.61127,1.37076 -6.93956,1.45532 l 0,-6.0369 c 2.74819,-0.0958 4.91052,-1.21746 7.20958,-2.10213 2.42015,-0.93127 5.0007,-1.63888 8.85671,-0.83547 l 0.21602,-1.05106 c -1.0201,-0.21255 -1.97734,-0.31888 -2.86223,-0.35036 -2.65469,-0.0944 -4.74436,0.5197 -6.61553,1.23972 -2.35623,0.90667 -4.34813,1.92327 -6.80455,2.02128 l 0,-5.84824 c 3.34553,-0.0728 5.57127,-1.29396 8.47868,-2.64114 1.25467,-0.58137 3.19103,-1.49949 5.04941,-1.77873 0.92919,-0.13963 1.83507,-0.12445 2.61921,0.13475 0.78413,0.25919 1.46827,0.75465 2.02516,1.64398 l 0.91807,-0.56596 c -0.67859,-1.08368 -1.59096,-1.77117 -2.5922,-2.10213 -0.50063,-0.16549 -1.01822,-0.24414 -1.53913,-0.26951 -0.5209,-0.0254 -1.04512,0.003 -1.56612,0.0809 -2.08401,0.31315 -4.10003,1.28204 -5.34643,1.85958 -2.93433,1.35965 -4.96744,2.48489 -8.04665,2.56029 l 0,-6.79151 c 2.74819,-0.0958 4.91052,-1.21746 7.20958,-2.10214 2.42015,-0.93126 5.0007,-1.63888 8.85671,-0.83546 l 0.21602,-1.05107 c -1.0201,-0.21254 -1.97734,-0.31887 -2.86223,-0.35035 -2.65469,-0.0944 -4.74436,0.5197 -6.61553,1.23972 -2.35623,0.90667 -4.34813,1.92326 -6.80455,2.02128 l 0,-6.89931 c 3.39345,0.002 6.78821,-0.58425 10.55785,-2.47944 l -0.48604,-0.94327 c -3.62186,1.82089 -6.79997,2.35008 -10.07181,2.34469 l 0,-6.57591 c 2.57935,-0.0163 5.55051,-0.82884 8.12765,-1.94043 l -0.40503,-0.97022 c -2.46457,1.06304 -5.36558,1.81486 -7.72262,1.83263 l 0,-25.549013 -0.86407,0 z" />
		<path transform="scale(2,2)" style="fill:#808080;fill-opacity:1;stroke:none;" d="m 47.93097,-52.154403 0,25.54902 c -2.35704,-0.0178 -5.25806,-0.7696 -7.72262,-1.83263 l -0.40504,0.97021 c 2.57715,1.1116 5.54831,1.92413 8.12766,1.94044 l 0,6.575897 c -3.27185,0.005 -6.44995,-0.523787 -10.07181,-2.344687 l -0.48604,0.94327 c 3.76964,1.895187 7.1644,2.480957 10.55785,2.479437 l 0,6.89931 c -2.45642,-0.098 -4.44832,-1.11461 -6.80455,-2.02128 -1.87117,-0.72002 -3.96084,-1.33415 -6.61553,-1.23972 -0.88489,0.0315 -1.84214,0.13781 -2.86223,0.35036 l 0.21602,1.05106 c 3.85601,-0.80342 6.43656,-0.0958 8.85671,0.83547 2.29906,0.88467 4.46139,2.0063 7.20958,2.10213 l 0,6.79151 c -3.07921,-0.0754 -5.11232,-1.20064 -8.04665,-2.56029 -1.2464,-0.57753 -3.26242,-1.54643 -5.34643,-1.85958 -0.52101,-0.0783 -1.04522,-0.10622 -1.56612,-0.0809 -0.52091,0.0254 -1.0385,0.10403 -1.53913,0.26951 -1.00125,0.33096 -1.91362,1.01845 -2.5922,2.10213 l 0.91807,0.56596 c 0.55689,-0.88933 1.24103,-1.38478 2.02516,-1.64398 0.78414,-0.25919 1.69002,-0.27437 2.61921,-0.13475 1.85838,0.27925 3.79474,1.19737 5.04941,1.77873 2.90741,1.34718 5.13315,2.56832 8.47868,2.64114 l 0,5.84825 c -2.45642,-0.098 -4.44832,-1.11461 -6.80455,-2.02128 -1.87117,-0.72002 -3.96084,-1.33415 -6.61553,-1.23972 -0.88489,0.0315 -1.84214,0.13781 -2.86223,0.35035 l 0.21602,1.05107 c 3.85601,-0.80342 6.43656,-0.0958 8.85671,0.83546 2.29906,0.88468 4.46139,2.0063 7.20958,2.10214 l 0,6.0369 c -3.3283,-0.0846 -5.16066,-0.74455 -6.93956,-1.45533 -1.85803,-0.7424 -3.70967,-1.52477 -6.88555,-1.53617 l 0,1.07801 c 3.00446,0.0108 4.60555,0.70616 6.48052,1.45533 1.7999,0.71917 3.85445,1.44808 7.34459,1.53617 l 0,6.036896 c -3.27185,0.005 -6.44995,-0.5238 -10.07181,-2.344686 l -0.48604,0.943266 c 3.76964,1.89518 7.1644,2.48096 10.55785,2.47944 l 0,6.06385 c -2.35704,-0.0178 -5.25806,-0.76959 -7.72262,-1.83263 l -0.40504,0.97022 c 2.57715,1.11159 5.54831,1.92412 8.12766,1.94043 l 0,3.98866 0.86407,0 0,-3.98866 c 2.57935,-0.0163 5.5505,-0.82884 8.12765,-1.94043 l -0.40504,-0.97022 c -2.46456,1.06304 -5.36558,1.81485 -7.72261,1.83263 l 0,-6.06385 c 3.39345,0.002 6.7882,-0.58426 10.55784,-2.47944 l -0.48604,-0.943266 c -3.62186,1.820886 -6.79996,2.350076 -10.0718,2.344686 l 0,-6.036896 c 3.49013,-0.0881 5.54468,-0.817 7.34458,-1.53617 1.87497,-0.74917 3.47606,-1.44454 6.48052,-1.45533 l 0,-1.07801 c -3.17588,0.0114 -5.02751,0.79377 -6.88555,1.53617 -1.7789,0.71078 -3.61126,1.37077 -6.93955,1.45533 l 0,-6.0369 c 2.74818,-0.0958 4.91051,-1.21746 7.20957,-2.10214 2.42015,-0.93126 5.0007,-1.63888 8.85671,-0.83546 l 0.21602,-1.05107 C 64.05725,0.698424 63.1,0.592094 62.21511,0.560614 c -2.65469,-0.0944 -4.74436,0.5197 -6.61553,1.23972 -2.35623,0.90667 -4.34812,1.92326 -6.80454,2.02128 l 0,-5.84825 c 3.34552,-0.0728 5.57126,-1.29396 8.47867,-2.64114 1.25467,-0.58136 3.19103,-1.49948 5.04941,-1.77873 0.92919,-0.13962 1.83508,-0.12444 2.61921,0.13475 0.78414,0.2592 1.46827,0.75465 2.02516,1.64398 l 0.91807,-0.56595 c -0.67858,-1.08369 -1.59095,-1.77117 -2.5922,-2.10214 -0.50063,-0.16548 -1.01822,-0.24414 -1.53913,-0.2695 -0.5209,-0.0254 -1.04511,0.003 -1.56612,0.0808 -2.08401,0.31315 -4.10003,1.28205 -5.34643,1.85958 -2.93433,1.35966 -4.96744,2.4849 -8.04664,2.5603 l 0,-6.79152 c 2.74818,-0.0958 4.91051,-1.21746 7.20957,-2.10213 2.42015,-0.93127 5.0007,-1.63888 8.85671,-0.83546 l 0.21602,-1.05107 c -1.02009,-0.21254 -1.97734,-0.31888 -2.86223,-0.35036 -2.65469,-0.0944 -4.74436,0.5197 -6.61553,1.23972 -2.35623,0.90668 -4.34812,1.92327 -6.80454,2.02129 l 0,-6.89932 c 3.39345,0.002 6.7882,-0.58425 10.55784,-2.479437 l -0.48604,-0.94327 c -3.62186,1.8209 -6.79996,2.350077 -10.0718,2.344687 l 0,-6.575897 c 2.57935,-0.0163 5.5505,-0.82884 8.12765,-1.94044 l -0.40504,-0.97021 c -2.46456,1.06303 -5.36558,1.81485 -7.72261,1.83263 l 0,-25.54902 -0.86407,0 z" />
		<path transform="scale(2,2)" style="fill:#808080;fill-opacity:1;stroke:none;" d="m -1.40198,-52.154403 0,25.54902 c -2.35704,-0.0178 -5.258055,-0.7696 -7.722615,-1.83263 l -0.40504,0.97021 c 2.57715,1.1116 5.548305,1.92413 8.127655,1.94044 l 0,6.575897 c -3.27185,0.005 -6.449945,-0.523787 -10.071805,-2.344687 l -0.48604,0.94327 c 3.76964,1.895187 7.164395,2.480957 10.557845,2.479437 l 0,6.89931 c -2.45641,-0.098 -4.44832,-1.11461 -6.804545,-2.02128 -1.87117,-0.72002 -3.96084,-1.33415 -6.61553,-1.23972 -0.88489,0.0315 -1.84214,0.13781 -2.86223,0.35036 l 0.21602,1.05106 c 3.85601,-0.80342 6.43656,-0.0958 8.85671,0.83547 2.29906,0.88467 4.461385,2.0063 7.209575,2.10213 l 0,6.79151 c -3.07921,-0.0754 -5.112315,-1.20064 -8.046645,-2.56029 -1.2464,-0.57753 -3.26242,-1.54643 -5.34643,-1.85958 -0.52101,-0.0783 -1.04522,-0.10622 -1.56612,-0.0809 -0.52091,0.0254 -1.0385,0.10403 -1.53913,0.26951 -1.00125,0.33096 -1.91362,1.01845 -2.5922,2.10213 l 0.91807,0.56596 c 0.55689,-0.88933 1.24103,-1.38478 2.02516,-1.64398 0.78414,-0.25919 1.69002,-0.27437 2.61921,-0.13475 1.85838,0.27925 3.79474,1.19737 5.04941,1.77873 2.90741,1.34718 5.133145,2.56832 8.478675,2.64114 l 0,5.84825 c -2.45642,-0.098 -4.44832,-1.11461 -6.804545,-2.02128 -1.87117,-0.72002 -3.96084,-1.33415 -6.61553,-1.23972 -0.88489,0.0315 -1.84214,0.13781 -2.86223,0.35035 l 0.21602,1.05107 c 3.85601,-0.80342 6.43656,-0.0958 8.85671,0.83546 2.29906,0.88468 4.461385,2.0063 7.209575,2.10214 l 0,6.0369 c -3.3283,-0.0846 -5.160655,-0.74455 -6.939555,-1.45533 -1.85803,-0.7424 -3.70967,-1.52477 -6.88555,-1.53617 l 0,1.07801 c 3.00446,0.0108 4.60555,0.70616 6.48052,1.45533 1.7999,0.71917 3.854445,1.44808 7.344585,1.53617 l 0,6.036896 c -3.27185,0.005 -6.449945,-0.5238 -10.071805,-2.344686 l -0.48604,0.943266 c 3.76964,1.89518 7.164395,2.48096 10.557845,2.47944 l 0,6.06385 c -2.35704,-0.0178 -5.258055,-0.76959 -7.722615,-1.83263 l -0.40504,0.97022 c 2.57715,1.11159 5.548305,1.92412 8.127655,1.94043 l 0,3.98866 0.86407,0 0,-3.98866 c 2.57935,-0.0163 5.5505,-0.82884 8.12765,-1.94043 L 7.1847,23.36068 c -2.46456,1.06304 -5.36558,1.81485 -7.72261,1.83263 l 0,-6.06385 c 3.39345,0.002 6.7882,-0.58426 10.55784,-2.47944 L 9.53389,15.706754 C 5.91203,17.52764 2.73393,18.05683 -0.53791,18.05144 l 0,-6.036896 c 3.49013,-0.0881 5.54468,-0.817 7.34458,-1.53617 1.87497,-0.74917 3.47606,-1.44454 6.48052,-1.45533 l 0,-1.07801 c -3.17588,0.0114 -5.02751,0.79377 -6.88555,1.53617 -1.7789,0.71078 -3.61126,1.37077 -6.93955,1.45533 l 0,-6.0369 c 2.74818,-0.0958 4.91051,-1.21746 7.20957,-2.10214 2.42015,-0.93126 5.0007,-1.63888 8.85671,-0.83546 l 0.21602,-1.05107 c -1.02009,-0.21254 -1.97734,-0.31887 -2.86223,-0.35035 -2.65469,-0.0944 -4.74436,0.5197 -6.61553,1.23972 -2.35623,0.90667 -4.34812,1.92326 -6.80454,2.02128 l 0,-5.84825 c 3.34552,-0.0728 5.57126,-1.29396 8.47867,-2.64114 1.25467,-0.58136 3.19103,-1.49948 5.04941,-1.77873 0.92919,-0.13962 1.83508,-0.12444 2.61921,0.13475 0.78414,0.2592 1.46827,0.75465 2.02516,1.64398 l 0.91807,-0.56595 c -0.67858,-1.08369 -1.59095,-1.77117 -2.5922,-2.10214 -0.50063,-0.16548 -1.01822,-0.24414 -1.53913,-0.2695 -0.5209,-0.0254 -1.04511,0.003 -1.56612,0.0808 -2.08401,0.31315 -4.10003,1.28205 -5.34643,1.85958 -2.93433,1.35966 -4.96744,2.4849 -8.04664,2.5603 l 0,-6.79152 c 2.74818,-0.0958 4.91051,-1.21746 7.20957,-2.10213 2.42015,-0.93127 5.0007,-1.63888 8.85671,-0.83546 l 0.21602,-1.05107 c -1.02009,-0.21254 -1.97734,-0.31888 -2.86223,-0.35036 -2.65469,-0.0944 -4.74436,0.5197 -6.61553,1.23972 -2.35623,0.90668 -4.34812,1.92327 -6.80454,2.02129 l 0,-6.89932 c 3.39345,0.002 6.7882,-0.58425 10.55784,-2.479437 l -0.48604,-0.94327 c -3.62186,1.8209 -6.79996,2.350077 -10.0718,2.344687 l 0,-6.575897 c 2.57935,-0.0163 5.5505,-0.82884 8.12765,-1.94044 l -0.40504,-0.97021 c -2.46456,1.06303 -5.36558,1.81485 -7.72261,1.83263 l 0,-25.54902 -0.86407,0 z" />
		'),
	'ermined' => array (  'link' => 'http://karlwilcox.com/parker/e/ermine', 'width' => 222, 'height' => 400, 'body' => '<g>
            <circle r="10" cx="55" cy="30"/>
            <circle r="10" cx="36" cy="55"/>
            <circle r="10" cx="74" cy="55"/>
            <path d="M 53 60 A 50 210 0 0,1 10,180 A 60 40 0 0,0 45,170 A 30 40 0, 0,0 55 200 A 30 40 0, 0,0 62,170 A 60 40 0 0,0 101, 180 A 50 210 0 0,1 57 60 Z"/>
        </g>
        <g transform="translate(111,200)">
            <circle r="10" cx="55" cy="30"/>
            <circle r="10" cx="36" cy="55"/>
            <circle r="10" cx="74" cy="55"/>
            <path d="M 53 60 A 50 210 0 0,1 10,180 A 60 40 0 0,0 45,170 A 30 40 0, 0,0 55 200 A 30 40 0, 0,0 62,170 A 60 40 0 0,0 101, 180 A 50 210 0 0,1 57 60 Z"/>
        </g>' ),

    'crusilly' => array(  'link' => 'http://karlwilcox.com/parker/c/crusily', 'width' => 200, 'height' => 200, 'body' => '  <path d="M 100,25 A 25,25 0 0 0 125,50 25,25 0 0 0 100,75 25,25 0 0 0 75,50 25,25 0 0 0 100,25" />
        <path d="m 97,50 0,50 6,0 0,-50 -6,0 z" />
        <path d="m 175,100 a 25,25 0 0 0 -25,25 25,25 0 0 0 -25,-25 25,25 0 0 0 25,-25 25,25 0 0 0 25,25" />
        <path d="m 100,97 0,6 50,0 0,-6 -50,0 z" />
        <path d="m 100,175 a 25,25 0 0 0 -25,-25 25,25 0 0 0 25,-25 25,25 0 0 0 25,25 25,25 0 0 0 -25,25"/>
        <path d="m 97,100 0,50 6,0 0,-50 -6,0 z"/>
        <path d="M 25,100 A 25,25 0 0 0 50,75 25,25 0 0 0 75,100 25,25 0 0 0 50,125 25,25 0 0 0 25,100"/>
        <path d="m 50,97 0,6 50,0 0,-6 -50,0 z"/>
        <path d="M 125,0 A 25,25 0 0 0 150,-25 25,25 0 0 0 175,0 25,25 0 0 0 150,25 25,25 0 0 0 125,0"/>
        <path d="m 150,-3 0,6 50,0 0,-6 -50,0 z"/>
        <path d="M 200,75 A 25,25 0 0 0 175,50 25,25 0 0 0 200,25 25,25 0 0 0 225,50 25,25 0 0 0 200,75"/>
        <path d="m 197,0 0,50 6,0 0,-50 -6,0 z"/>
        <path d="M 75,0 A 25,25 0 0 0 50,25 25,25 0 0 0 25,0 25,25 0 0 0 50,-25 25,25 0 0 0 75,0"/>
        <path d="M 0,-3 0,3 50,3 50,-3 0,-3 z"/>
        <path d="M 0,75 A 25,25 0 0 0 -25,50 25,25 0 0 0 0,25 25,25 0 0 0 25,50 25,25 0 0 0 0,75"/>
        <path d="M -3,0 -3,50 3,50 3,0 -3,0 z"/>
        <path d="M 0,125 A 25,25 0 0 0 25,150 25,25 0 0 0 0,175 25,25 0 0 0 -25,150 25,25 0 0 0 0,125"/>
        <path d="m -3,150 0,50 6,0 0,-50 -6,0 z"/>
        <path d="M 75,200 A 25,25 0 0 0 50,225 25,25 0 0 0 25,200 25,25 0 0 0 50,175 25,25 0 0 0 75,200" />
        <path d="m 0,197 0,6 50,0 0,-6 -50,0 z" />
        <path d="m 200,125 a 25,25 0 0 0 25,25 25,25 0 0 0 -25,25 25,25 0 0 0 -25,-25 25,25 0 0 0 25,-25" />
        <path d="m 197,150 0,50 6,0 0,-50 -6,0 z" />
        <path d="m 125,200 a 25,25 0 0 0 25,-25 25,25 0 0 0 25,25 25,25 0 0 0 -25,25 25,25 0 0 0 -25,-25" />
        <path d="m 150,197 0,6 50,0 0,-6 -50,0 z" />' ),
    'fretty' => array (  'link' => 'http://karlwilcox.com/parker/f/fret', 'width' => 200, 'height' => 200, 'body' => '<polygon points="0,20 76,96 96,76 20,0 0,0" />
        <polygon points="180,200 104,124 124,104 200,180 200,200" />
        <polygon points="4,176 176,4 196,24 24,196" />
        <polygon points="0,180 0,200 20,200" />
        <polygon points="180,0 200,0 200,20" />' ),
    'grillage' => array (  'link' => 'http://karlwilcox.com/parker/g/grillete', 'width' => 200, 'height' => 200, 'body' => '<polygon points="80,0 100,0 100,76 80,76" />
        <polygon points="80,104 100,104 100,200 80,200" />
        <polygon points="180,4 200,4 200,176 180,176" />
        <polygon points="4,80 4,100 176,100 176,80" />
        <polygon points="0,180 0,200 76,200 76,180" />
        <polygon points="104,180 104,200 200,200 200,180" />' ),
    'honeycombed' => array ( 'width' => 300, 'height' => 347, 'body' =>
         '<path d="m 153.4422,92.600196 -46.21319,80.043594 45.12205,81.13837 95.02852,1.00289 46.35761,-82.54424 -45.99123,-79.659144 -94.30376,0.01853 z m -6.68594,-10.028905 -52.060166,90.170859 53.401696,91.51979 105.30491,0 52.25179,-90.1727 -53.28385,-92.224757 -105.61438,0.706808 z" fill-rule="evenodd" />
          <path d="M 3.4422,6.600196 -42.77099,86.64379 2.35106,167.78216 97.37958,168.78505 143.73719,86.24081 97.74596,6.581666 3.4422,6.600196 z m -6.68594,-10.028905 -52.060166,90.170859 53.401696,91.51979 105.30491,0 52.25179,-90.1727 -53.28385,-92.224757 -105.61438,0.706808 z" fill-rule="evenodd" />
          <path d="m 3.4422,180.6002 -46.21319,80.04359 45.12205,81.13837 95.02852,1.00289 46.35761,-82.54424 -45.99123,-79.65914 -94.30376,0.0185 z m -6.68594,-10.02891 -52.060166,90.17086 53.401696,91.51979 105.30491,0 52.25179,-90.1727 -53.28385,-92.22476 -105.61438,0.70681 z" fill-rule="evenodd" />
          <path d="m 303.4422,8.600196 -46.21319,80.043594 45.12205,81.13837 95.02852,1.00289 46.35761,-82.54424 -45.99123,-79.659144 -94.30376,0.01853 z m -6.68594,-10.028905 -52.06017,90.170859 53.4017,91.51979 105.30491,0 52.25179,-90.1727 -53.28385,-92.224757 -105.61438,0.706808 z" fill-rule="evenodd" />
          <path d="m 303.4422,178.6002 -46.21319,80.04359 45.12205,81.13837 95.02852,1.00289 46.35761,-82.54424 -45.99123,-79.65914 -94.30376,0.0185 z m -6.68594,-10.02891 -52.06017,90.17086 53.4017,91.51979 105.30491,0 52.25179,-90.1727 -53.28385,-92.22476 -105.61438,0.70681 z" fill-rule="evenodd" />
         '),
    'maily' => array ( 'width' => 100, 'height' => 100, 'body' =>
         '<path d="m 2.124176,-59.94799 c -19.256231,-0.65144 -38.51525,7.93755 -50.670736,24.66794 -19.448777,26.76862 -13.488434,64.36039 13.280512,83.80893 26.768945,19.44854 64.361178,13.5193 83.809955,-13.24932 L 42.120856,30.59421 C 25.195428,53.88978 -7.2847804,59.03113 -30.580634,42.10591 -53.876488,25.18069 -59.048937,-7.29912 -42.123509,-30.59469 -25.19808,-53.89026 7.3131568,-59.03162 30.609011,-42.1064 l 0.124117,0.0931 c 16.874227,12.33677 24.727375,33.53658 19.951796,53.89712 l 7.726279,1.8307 C 63.92381,-9.78832 54.793836,-34.33985 35.263396,-48.52937 25.225041,-55.82257 13.677915,-59.55712 2.124176,-59.94799 z" />
          <path d="M 159.90246,2.12025 C 160.5539,-17.13599 151.96491,-36.395 135.23452,-48.55049 108.4659,-67.99927 70.874126,-62.03893 51.425585,-35.26998 31.977045,-8.50104 37.906287,29.0912 64.674906,48.53998 l 4.685357,-6.42306 C 46.064693,25.1915 40.923336,-7.28871 57.848558,-30.58457 c 16.925222,-23.29585 49.405032,-28.4683 72.700602,-11.54287 23.29557,16.92543 28.43693,49.43667 11.51171,72.73252 l -0.0931,0.12412 C 129.631,47.60342 108.43119,55.45657 88.070652,50.68099 l -1.830702,7.72628 c 23.50283,5.51261 48.05436,-3.61737 62.24388,-23.14781 7.2932,-10.03835 11.02775,-21.58548 11.41862,-33.13921 z" />
          <path d="m 97.834225,159.89852 c 19.256235,0.65144 38.515245,-7.93755 50.670735,-24.66794 C 167.95374,108.46196 161.9934,70.87019 135.22445,51.42165 108.45551,31.9731 70.863272,37.90235 51.414495,64.67097 l 6.423051,4.68535 C 74.762974,46.06075 107.24318,40.9194 130.53904,57.84462 c 23.29585,16.92522 28.4683,49.40503 11.54287,72.7006 -16.92543,23.29557 -49.436666,28.43693 -72.73252,11.51171 l -0.124117,-0.0931 C 52.351046,129.62707 44.497898,108.42726 49.273478,88.06672 l -7.726279,-1.8307 c -5.512608,23.50283 3.617366,48.05436 23.147806,62.24388 10.038355,7.2932 21.585481,11.02775 33.13922,11.41862 z" />
          <path d="m -59.944058,97.83028 c -0.651442,19.25624 7.937552,38.51525 24.667939,50.67074 26.76862,19.44878 64.360395,13.48844 83.808936,-13.28051 19.44854,-26.76894 13.519299,-64.36118 -13.249321,-83.80996 l -4.685357,6.42306 c 23.29557,16.92542 28.436927,49.40563 11.511705,72.70149 -16.925222,23.29585 -49.4050352,28.4683 -72.700606,11.54287 -23.29557,-16.92543 -28.436927,-49.43667 -11.511705,-72.73252 l 0.09309,-0.12412 C -29.672608,52.34711 -8.472792,44.49396 11.887743,49.26954 l 1.830702,-7.72628 c -23.5028342,-5.51261 -48.05436,3.61737 -62.243882,23.14781 -7.293202,10.03835 -11.027753,21.58548 -11.418618,33.13921 z" />
         ' ),
    'masoned' => array (  'link' => 'http://karlwilcox.com/parker/m/masoned', 'width' => 200, 'height' => 140, 'body' => '<polygon points="0,0 20,0 20,50 200,50 200,70 110,70 110,120 200,120 200,140 0,140 0,120 90,120 90,70 0,70 " />' ),
    'papelonny' => array ( 'width' => 100, 'height' => 100, 'body' => '<path d="M 50,0 A 50 50 0 0,1 0,50 A 50 50 0 0,0 100,50 A 50 50 0 0,1 50,0" />' ),
    'scaly' => array ( 'width' => 100, 'height' => 100, 'body' => '<path d="M 0,0 A 50 30 0 0,0 100,0 A 50 50 0 0,1 0,0" />
        <path d="M -50,50 A 50,30 0 0 0 50,50 50,50 0 0 1 -50,50" />
        <path d="M 50,50 A 50,30 0 0 0 150,50 50,50 0 0 1 50,50" />' ),
    'vairy' => array ( 'width' => 125, 'height' => 240, 'body' => '<polygon points="62.5,0 96.5,20 96.5,100 125,120 0,120 33,100 33,20" />
        <polygon points="125,120 159,140 159,220 187.5,240 62.5,240 95.5,220 95.5,140" />
        <polygon points="0,120 34,140 34,220 62.5,240 -62.5,240 -29.5,220 -29.5,140" />' ),
    'checky9' => array (  'link' => 'http://karlwilcox.com/parker/c/chequy', 'width' => 1000, 'height' => 1200, 'body' => '<path d="M 333,0 h333v400h-333z" />
        <path d="M 0,400 h333v400h-333z" /><path d="M 666,400 h334v400h-334z" /><path d="M 333,800 h333v400h-333z" />'),
  );

  $name = $node->getAttribute('name');
  $parent = $node->parentNode;
  // Some treatments are rotated if on some ordinaries
  if ( $parent->nodeName == 'ordinary' ) {
    $ord_type = $parent->getAttribute('subtype');
    if ( $ord_type == 'saltire' or substr($ord_type,0,6) == 'chevron' ) {
      if ( array_key_exists($name . '45', $treatment_data) ) $name .= '45';
    }
  }

  $children = $node->childNodes;
  $tinctures = array();
  foreach ( $children as $child ) {
    if ( $child->nodeName == 'tincture' )
      $tinctures[$child->getAttribute('index')] = $child;
  }
  if ( array_key_exists($name, $treatment_data) ) {
    $treatment = $treatment_data[$name]['body'];
    $size_x = $treatment_data[$name]['width'];
    $size_y = $treatment_data[$name]['height'];
    $base = apply_tincture ( $tinctures[1], '<rect x="0" y="0" width="' .
                  $size_x . '" height="' . $size_y . '" />', "$size_x,$size_y" );
    $pattern = apply_tincture ( $tinctures[2], $treatment, "$size_x,$size_y" );
    $retval = array ( 'width' =>  $size_x, 'height' => $size_y, 'body' => $base . '<g stroke-width="2" stroke="' . rgb('pattern-stroke') . '" >' .$pattern . '</g>' );
    if ( isset($treatment_data[$name]['link']) )
      $retval['link'] = $treatment_data[$name]['link'];
    return $retval;
  } else {
    draw_message('internal', "Cannot draw treatment $name", __FILE__, __LINE__);
    return array ( 'width' => 100, 'height' => 100, 'body' => '<rect x="0" y="0" width="100" height="100" fill="#888888" />' );
  }
}

function makeSemy( $node ) {
  $name = $node->getAttribute('name');
  $children = $node->childNodes;
  $background = $charge = null;
  foreach ( $children as $child ) {
    if ( $child->nodeName == 'tincture' )
      $background = $child;
   elseif ( $child->nodeName == 'charge' )
     $charge = $child;
  }
  if ( $background == null or $charge == null )
    draw_message('internal', 'Bad semyde element', __FILE__, __LINE__ );
 if ( strpos ( $name, 'counter-' ) === 0 ) { // See rewriter.inc, some treatments are rewritten as semyde
    // special layout
    $semy = PlaceCharge($charge, 100, 100, 50, 50, 90);
    $semy .= PlaceCharge($charge, 100, 100, 200, 50, 90);
    $semy .= PlaceCharge($charge, 100, 100, 25, 175);
    $semy .= PlaceCharge($charge, 100, 100, 125, 175);
    $semy .= PlaceCharge($charge, 100, 100, 225, 175);
    $base = apply_tincture ( $background, '<rect x="0" y="0" width="300" height="250" />' );
    return array (  'link' => 'http://karlwilcox.com/parker/s/seme', 'width' => 300, 'height' => 250, 'body' => $base . $semy );
  } else {
    $semy = PlaceCharge($charge, 100, 100, 50, 50);
    $semy .= PlaceCharge($charge, 100, 100, 150, 150);
    $base = apply_tincture ( $background, '<rect x="0" y="0" width="200" height="200" />' );
    return array (  'link' => 'http://karlwilcox.com/parker/s/seme', 'width' => 200, 'height' => 200, 'body' => $base . $semy );
 }
}
